<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Comment_m extends CI_Model{
    public function __construct() {
        parent::__construct();
        $this->load->database();
    }
    public function insert_mail($email_from,$email_to,$email_cc,$email_bcc,$subject,$content)
    {
        $data = array(  
            'email_from'=>$email_from,                  
            'email_to'=>$email_to,
            'email_cc'=>$email_cc,
            'email_bcc'=>$email_bcc,
            'subject'=>$subject,
            'content'=>$content,
            
                     );
        $this->db->insert('comment',$data);
    }
    public function reply_mail($email_from,$email_to,$subject,$content)
    {
        $data = array(  
            'email_from'=>$email_from,                  
            'email_to'=>$email_to,
            'subject'=>$subject,
            'content'=>$content,
                     );
        $this->db->insert('comment',$data);
    }
    public function list_send_mail($email)
    {
        $this->db->select('*');
        $this->db->where('email_from',$email);
        $this->db->from('comment');
        $query=$this->db->get();
        return $query;
    }
    public function list_inbox_mail($email)
    {
        $query=$this->db->query("select * from comment where email_to='$email'or email_cc='$email' or email_bcc='$email'");
        return $query;
    }
    public function get_comment($id_com)
    {
        $this->db->select('*');
        $this->db->where('id_com',$id_com);
        $this->db->from('comment');
        $query=$this->db->get();
        return $query;
    }
    
    public function deleteMail($id_com)
    {
        $this->db->where('id_com',$id_com);
        $this->db->delete('comment');
    }
}
?>
